import { defineStore } from 'pinia'
import { computed, ref } from 'vue'
import { Sex } from './store-name'

export const useGender = defineStore(Sex.Man, () => {
  const current = ref<number>(10)
  const name = ref<string>('Jetwang')

  const currentName = computed(() => {
    return current.value + '---' + name.value
  })

  const asyncChangeName = () => {
    setTimeout(() => {
      name.value = 'Jack'
    }, 1000)
  }

  return {
    current, name, currentName, asyncChangeName
  }
})
